package com.example.big_event.mapper;

import com.example.big_event.pojo.Category;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import java.util.List;

@Mapper//生命这是一个mapper接口
@Validated
public interface CategoryMapper {


    @Insert("insert into category (create_user,category_name,category_alias,create_time,update_time)" +
            " values(#{id},#{categoryName},#{categoryAlias},#{createTime},#{updateTime})")
    void add(Category category);

    @Select("select * from category where create_user = #{id}")
    List<Category> select(Integer id);

    @Select("select * from category where id = #{id}" )
    List<Category> findByid(Integer id);


    @Delete("DELETE FROM category WHERE id = #{id};")
    void delete(Integer id);

    @Update("update category set category_name = #{categoryName},category_alias = #{categoryAlias},update_time = #{updateTime} where id = #{id}")
    void update(Category category);
}
